home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / WINDOWS / WGREP12.ARJ / GREPDLL.TXT < prev    next >
Text File  |  1992-05-01  |  5KB  |  122 lines

  1.      Documentation for GREP.DLL
  2.      Written by: Chris Roberts 03/16/92
  3.  
  4.  
  5.      The Grep DLL was written to  enhance Huw Millington's WinGrep program.
  6.      It allows the  program  access  to  a  more  robust  set  of GREP type
  7.      searches. But, it may be used as a grep engine to any program that has
  8.      the ability to call a DLL.
  9.  
  10.  
  11.      Version 1.0  of  GREP.DLL  has  three  functions.  The  first function
  12.      returns the version number.  This  is  not  of  any importance... yet.
  13.      High-byte is major version number,  low-byte  is minor version number.
  14.      IE. 0x0100 = version 1.0, 0x0210 = 2.10.
  15.  
  16.           WORD FAR PASCAL GrepVersion( void );
  17.  
  18.  
  19.      The second is the  CompileGrep()  function.  This  function is used to
  20.      compile a search string into  a  string  used  more efficiently by the
  21.      Grep Engine. It is passed a GrepString to compile, which it returns in
  22.      CompiledGrep. Passing a non-zero value  for  IgnoreCase will cause the
  23.      searches to ignore case, while a zero will force case-sensitivity.
  24.  
  25.          int FAR PASCAL  CompileGrep(char  *GrepString, char *CompiledGrep,
  26.      char IgnoreCase );
  27.  
  28.      It returns a  zero  (0)  if  the  GrepString  was  valid, otherwise it
  29.      returns an error code reporting that the GrepString was NOT valid:
  30.  
  31.      GCOMP_NO_ERROR                 No error occurred.
  32.  
  33.      GCOMP_ILLEGAL_OCCURANCE_OP     An *, +, or  -  appeared in an invalid
  34.                                     place. These cannot follow a ^ or a $.
  35.  
  36.      GCOMP_UNKNOWN_TYPE             Illegal type given for  a ':' command.
  37.                                     The only  valid  types  are  'a', 'd',
  38.                                     'n', and ' '.
  39.  
  40.      GCOMP_NO_TYPE                  The ':' command was  given as the last
  41.                                     character in a search string.
  42.      GCOMP_BAD_CLASS_TERMINATION    A quoted character coammnd '\' without
  43.                                     a character to  quote  (ie.  it is the
  44.                                     end of the  string)  was  listed  in a
  45.                                     class '[]'. ie. '[abc\'.
  46.      GCOMP_UNTERMINATED_CLASS       There is no  corresponding  ']' with a
  47.                                     '['.
  48.      GCOMP_CLASS_TOO_LARGE          A class is larger than 256 characters.
  49.  
  50.      GCOMP_EMPTY_CLASS              An  empty  class  was  specified.  ie.
  51.                                     'AB[]YZ'.
  52.  
  53.      The error code constants are  defined  in  GREP.H.  If the compile was
  54.      successful CompiledGrep now contains a  grep  string  that may be used
  55.      for searches.
  56.  
  57.  
  58.      The third function  in  GREP.DLL  is  simply  called  Grep(). This, of
  59.      course, does all of the work of checking for a match.
  60.  
  61.          int FAR PASCAL Grep( char *StringToSearch, char *CompiledGrep );
  62.  
  63.      Grep() returns the position of the first character of the match (ie. 1
  64.      = first character), or zero (0) if there was no match.
  65.  
  66.      The following commands are supported GREP commands:
  67.  
  68.  
  69.      \       The backslash quotes any character.  This allows a search that
  70.              contains a character that is usually a GREP command.
  71.              Example:
  72.  
  73.              \$ matches a dollar-sign.
  74.  
  75.      ^       A circumflex at the  beginning  of  an  expression matches the
  76.              beginning of a line.
  77.  
  78.      $       A dollar-sign at the end of an expression matches the end of a
  79.              line.
  80.  
  81.      ?       A question mark  matches  any  SINGLE  character (except "new-
  82.              line").
  83.  
  84.      :_      A colon  matches  a  class  of  characters  described  by  the
  85.              following character:
  86.  
  87.              :a matches any alphabetic (always ignores case)
  88.              :d matches digits
  89.              :n matches alphanumerics  (always ignores case)
  90.              :  matches spaces, tabs, and other control characters, such as
  91.              new-line.
  92.  
  93.      *       An expression followed by  an  asterisk  matches  ZERO or more
  94.              occurrances of that expression:
  95.  
  96.              fo* matches f, fo, foo, etc
  97.              a*z matches az, abz, akfuhidfgnidhgz, etc
  98.  
  99.      +       An expression followed by  a  plus  sign  matches  ONE or more
  100.              occurrances of that expression:
  101.  
  102.              fo+ matches fo, etc
  103.  
  104.      -       An expression followed by a  minus sign optionally matches the
  105.              expression.
  106.  
  107.      []      A string enclosed in square  brackets matches any character in
  108.              that string, but no  others.  If  the  first  character in the
  109.              string is a circumflex,  the  expression matches any character
  110.              except "new-line" and the characters in the string.
  111.              Example:
  112.  
  113.              [xyz]  matches  xx,   and  zyx,  while
  114.              [^xyz] matches abc but not axb.
  115.  
  116.              A range of  characters  may  be  specified  by  two characters
  117.              separated by -.  Note that,     [a-z]   matches   alphabetics,
  118.              while [z-a] never matches.
  119.  
  120.  
  121.  
  122.